home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / ATL_Samples / countctn / countdlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.4 KB  |  90 lines

  1. // CountDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "CountCtn.h"
  6. #include "CountDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CCountCtnDlg dialog
  16.  
  17. CCountCtnDlg::CCountCtnDlg(CWnd* pParent /*=NULL*/)
  18.     : CDialog(CCountCtnDlg::IDD, pParent)
  19. {
  20.     //{{AFX_DATA_INIT(CCountCtnDlg)
  21.         // NOTE: the ClassWizard will add member initialization here
  22.     //}}AFX_DATA_INIT
  23.     // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  24.     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  25.     m_nMaxCounter = 10;
  26. }
  27.  
  28. void CCountCtnDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30.     CDialog::DoDataExchange(pDX);
  31.     //{{AFX_DATA_MAP(CCountCtnDlg)
  32.         // NOTE: the ClassWizard will add DDX and DDV calls here
  33.     DDX_Control(pDX, IDC_COUNTER, m_Counter);
  34.     DDX_Text(pDX, IDC_EDIT_MAXCOUNTER, m_nMaxCounter);
  35.     DDV_MinMaxInt(pDX, m_nMaxCounter, 1, 15);
  36.     //}}AFX_DATA_MAP
  37. }
  38.  
  39. BEGIN_MESSAGE_MAP(CCountCtnDlg, CDialog)
  40.     //{{AFX_MSG_MAP(CCountCtnDlg)
  41. // MM not needed in wce dialogs:    ON_WM_PAINT()
  42. // MM not needed in wce dialogs:    ON_WM_QUERYDRAGICON()
  43.     ON_BN_CLICKED(IDC_START, OnStart)
  44.     ON_BN_CLICKED(IDC_APPLY, OnSetMaxCounter)
  45.     ON_WM_CLOSE()
  46.     //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CCountCtnDlg message handlers
  51.  
  52. BOOL CCountCtnDlg::OnInitDialog()
  53. {
  54.     CDialog::OnInitDialog();
  55.  
  56.     // Workaround needed on 7258 version of MFC in ROM.  Needed so that events
  57.     // fired from ATL are handled correctly.
  58.     // Note: m_Counter must already be attached to a window.
  59.     ATLConnectSinks(&m_Counter);
  60.  
  61.     // Set the icon for this dialog.  The framework does this automatically
  62.     //  when the application's main window is not a dialog
  63.     SetIcon(m_hIcon, TRUE);            // Set big icon
  64.     SetIcon(m_hIcon, FALSE);        // Set small icon
  65.     
  66.     CenterWindow(GetDesktopWindow());    // center to the hpc screen
  67.  
  68.     // Set initial value for counter
  69.     m_Counter.SetMaxCounter(m_nMaxCounter);
  70.     
  71.     return TRUE;  // return TRUE  unless you set the focus to a control
  72. }
  73.  
  74. void CCountCtnDlg::OnStart() 
  75. {
  76.      m_Counter.StartCounting();
  77. }
  78.  
  79. void CCountCtnDlg::OnSetMaxCounter() 
  80. {
  81.     if(UpdateData())
  82.         m_Counter.SetMaxCounter(m_nMaxCounter);
  83. }
  84.  
  85. void CCountCtnDlg::OnClose() 
  86. {
  87.     CDialog::OnClose();
  88. }
  89.  
  90.